package com.carreirati.evaluation;

import java.util.List;

import com.carreirati.evaluation.domain.VwGetEvaluationHistoricalInformation;
import com.carreirati.evaluation.domain.VwGetEvaluationResultsByKnowledgeArea;

import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.roo.addon.web.mvc.controller.json.RooWebJson;
import org.springframework.roo.addon.web.mvc.controller.scaffold.RooWebScaffold;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@RequestMapping("/vwgetevaluationresultsbyknowledgeareas")
@Controller
@RooWebScaffold(path = "vwgetevaluationresultsbyknowledgeareas", formBackingObject = VwGetEvaluationResultsByKnowledgeArea.class)
@RooWebJson(jsonObject = VwGetEvaluationResultsByKnowledgeArea.class)
public class VwGetEvaluationResultsByKnowledgeAreaController {
	
	 @RequestMapping(value = "/find{knowledgeAreaId}", headers = "Accept=application/json")
	    @ResponseBody
	    public ResponseEntity<java.lang.String> findJson(@PathVariable("knowledgeAreaId") long knowledgeAreaId) {
	        HttpHeaders headers = new HttpHeaders();
	        headers.add("Content-Type", "application/json; charset=utf-8");
	        List<VwGetEvaluationResultsByKnowledgeArea> result = VwGetEvaluationResultsByKnowledgeArea.findAllVwGetEvaluationResultsByKnowledgeArea(knowledgeAreaId);
	        return new ResponseEntity<String>(VwGetEvaluationResultsByKnowledgeArea.toJsonArray(result), headers, HttpStatus.OK);
	    }
	 
	 @RequestMapping(value = "/findAll", headers = "Accept=application/json")
	    @ResponseBody
	    public ResponseEntity<java.lang.String> findAllJson( ) {
	        HttpHeaders headers = new HttpHeaders();
	        headers.add("Content-Type", "application/json; charset=utf-8");
	        List<VwGetEvaluationResultsByKnowledgeArea> result = VwGetEvaluationResultsByKnowledgeArea.findAllVwGetEvaluationResultsByKnowledgeAreas();
	        return new ResponseEntity<String>(VwGetEvaluationResultsByKnowledgeArea.toJsonArray(result), headers, HttpStatus.OK);
	    }
	 
	 
	 @RequestMapping(value = "/findFiltered{profileId}", headers = "Accept=application/json")
	    @ResponseBody
	    public ResponseEntity<java.lang.String> findFilteredJson(@PathVariable("profileId") String  profileId,@RequestParam("params") String params) {
	          HttpHeaders headers = new HttpHeaders();
	        headers.add("Content-Type", "application/json; charset=utf-8");
	        List<VwGetEvaluationResultsByKnowledgeArea> result = VwGetEvaluationResultsByKnowledgeArea.findAllVwGetEvaluationResultsByKnowledgeArea(params, profileId);
	        return new ResponseEntity<String>(VwGetEvaluationResultsByKnowledgeArea.toJsonArray(result), headers, HttpStatus.OK);
	    }
	 
	 @RequestMapping(value = "/getDefaultResults{profileId}", headers = "Accept=application/json")
	    @ResponseBody
	    public ResponseEntity<java.lang.String> findFilteredJson(@PathVariable("profileId") String  profileId) {
	          HttpHeaders headers = new HttpHeaders();
	        headers.add("Content-Type", "application/json; charset=utf-8");
	        List<VwGetEvaluationResultsByKnowledgeArea> result = VwGetEvaluationResultsByKnowledgeArea.getProfileQueryByKnowledgeArea( profileId);
	        return new ResponseEntity<String>(VwGetEvaluationResultsByKnowledgeArea.toJsonArray(result), headers, HttpStatus.OK);
	    }
}
